package com.example.myprojectoffeixue;
import android.content.Context;
import android.widget.Toast;
import java.util.Timer;
import java.util.TimerTask;
/**
 * Created by ASUS on 2016/10/28.
 */
public class HttpConnection {
    protected static Toast toast = null;
    private static String oldMsg;
    private static long oneTime = 0;
    private static long twoTime = 0;
    public static String updateScene="http://" + UserClass.ServerIP +"/FXMobiServer/scene/updateScene";
    public static String getSceneDetail="http://" + UserClass.ServerIP +"/FXMobiServer/scene/getSceneDetail";
    public static String deleteScene="http://" + UserClass.ServerIP +"/FXMobiServer/scene/deleteScene";
    public static String shutdownScene = "http://" + UserClass.ServerIP + "/FXMobiServer/scene/shutdownScene";
    public static String startupScene = "http://" + UserClass.ServerIP + "/FXMobiServer/scene/startupScene";
    public static String getSceneList = "http://" + UserClass.ServerIP + "/FXMobiServer/scene/getSceneList";
    public static String addScene = "http://" + UserClass.ServerIP + "/FXMobiServer/scene/addScene";
    public static String renameDevice = "http://" + UserClass.ServerIP + "/FXMobiServer/device/renameDevice";
    public static String changeStatus = "http://" + UserClass.ServerIP + "/FXMobiServer/device/changeStatus";
    public static String login = "http://" + UserClass.ServerIP + "/FXMobiServer/user/login";
    public static String updateJpush = "http://" + UserClass.ServerIP + "/FXMobiServer/user/updateJpush";
    public static String getDeviceList = "http://" + UserClass.ServerIP + "/FXMobiServer/device/getDeviceList";
    public static String getDeviceListByRoom = "http://" + UserClass.ServerIP + "/FXMobiServer/device/getDeviceListByRoom";
    public static String sendCaptcha = "http://" + UserClass.ServerIP + "/FXMobiServer/user/sendCaptcha";
    public static String register = "http://" + UserClass.ServerIP + "/FXMobiServer/user/register";
    public static String getKind = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/getKind";
    public static String add = "http://" + UserClass.ServerIP + "/FXMobiServer/device/add";
    public static String getMagnet = "http://" + UserClass.ServerIP + "/FXMobiServer/user/getMagnet";
    public static String getInfraredInfo = "http://" + UserClass.ServerIP + "/FXMobiServer/user/getInfraredInfo";
    public static String loadArcCode = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/loadArcCode";
    public static String getModelList = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/getModelList";
    public static String updateApp = "http://" + UserClass.ServerIP + "/FXMobiServer/user/updateApp";
    public static String deleteDevice = "http://" + UserClass.ServerIP + "/FXMobiServer/device/deleteDevice";
    public static String loadController = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/loadController";
    public static String deleteController = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/deleteController";
    public static String getCompanyList = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/getCompanyList";
    public static String addController = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/addController";
    public static String addArcController = "http://" + UserClass.ServerIP + "/FXMobiServer/remote/addArcController";
    public static String forgetPassword = "http://" + UserClass.ServerIP + "/FXMobiServer/user/forgetPassword";
    public static String resetPassword = "http://" + UserClass.ServerIP + "/FXMobiServer/user/resetPassword";
    public static String returncode;
    public static String deviceAuthorizedList = "http://" + UserClass.ServerIP + "/FXMobiServer/device/deviceAuthorizedList";
    public static String canAuthorizeList = "http://" + UserClass.ServerIP + "/FXMobiServer/device/canAuthorizeList";
    public static String deviceAuthorized = "http://" + UserClass.ServerIP + "/FXMobiServer/device/deviceAuthorized";
    //获取待接收或已接受网关
    public static String authorizeAcceptMacList = "http://" + UserClass.ServerIP + "/FXMobiServer/device/authorizeAcceptMacList";
    //接受网关
    public static String confirmAuthMac = "http://" + UserClass.ServerIP + "/FXMobiServer/device/confirmAuthMac";
    //删除网关

    public static String deleteAuthMac = "http://" + UserClass.ServerIP + "/FXMobiServer/device/deleteAuthMac";
    public static String addLabel = "http://" + UserClass.ServerIP + "/FXMobiServer/label/addLabel";//添加房间
    public static String updateLabel = "http://" + UserClass.ServerIP + "/FXMobiServer/label/updateLabel";//更新房间
    public static String  getLabelList="http://"+ UserClass.ServerIP +"/FXMobiServer/label/getLabelList";//获取房间
    public static String  deleteLabel="http://"+ UserClass.ServerIP +"/FXMobiServer/label/deleteLabel";//删除动画

    public static void showToast(Context context, String s) {
        if (context != null) {
            if (toast == null) {
                toast = Toast.makeText(context, s, Toast.LENGTH_SHORT);
                toast.show();
                oneTime = System.currentTimeMillis();
            } else {
                twoTime = System.currentTimeMillis();
                if (s.equals(oldMsg)) {
                    if (twoTime - oneTime > Toast.LENGTH_SHORT) {
                        toast.show();
                    }
                } else {
                    oldMsg = s;
                    toast.setText(s);
                    toast.show();
                }
            }
            oneTime = twoTime;
        }
    }


    public static void toastLog(String s, Context con) {

        showToast(con,s);

    }

}